﻿using System;
using System.Collections.Generic;
using Deixei.Infrastructure;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Deixei.UnitTestProject
{
    [TestClass]
    public class PagedListUnitTest
    {
        [TestMethod]
        public void CalculatePageCount_TestMethod()
        {
            List<string> list = new List<string>();
            for ( int i = 0; i < 10; i++ )
            {
                list.Add("Item "+ i);
            }

            PagedList<string> pl = new PagedList<string>(list, 1, 10, 100);

            Assert.AreEqual(pl.TotalPages, 10);
            Assert.AreEqual(pl.ContentList.Count, 10);

            list.Add("Item 11");
            PagedList<string> pl2 = new PagedList<string>(list, 1, 10, 101);

            Assert.AreEqual(pl2.TotalPages, 11);
            Assert.AreEqual(pl2.ContentList.Count, 10);
        }
    }
}
